package com.atguigu.gmall.pay.controller;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.request.AlipayTradePagePayRequest;
import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.pay.config.AlipayProperties;
import com.atguigu.gmall.pay.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @author A
 * @version 1.0
 * @description: TODO
 * @date 2024/10/14 2:04
 */
@RestController
@RequestMapping("/api/payment/alipay")
public class PayController {
    @Autowired
    PayService payService;


    @GetMapping("/submit/{orderId}")
    public String submit(@PathVariable("orderId") Long orderId) throws AlipayApiException {

        String body=payService.submit(orderId);

        //把这个页面交给浏览器,页面自动渲染,就会自动提交到表单到支付宝网关,支付宝网关给浏览器响应二维码收款台页面
        return body;
    }


}
